﻿using DevExpress.Web.ASPxEditors;
using DevExpress.Web.ASPxGridView;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utility1;

namespace eDream.Page
{
    public partial class Donhang_ : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }

        void Bindata_noLog(string dh)
        {
            try
            {
                Xuly xl = new Xuly();
                string sql = string.Format("select d0.datePost,d0.trangthai, d1.Ma_DH,d1.Soluong,d1.Gia,d1.tongtien,d1.ProductID ,p.iProName,p.image from Giohang d1 inner join Don_hang d0 on d0.Ma_DH=d1.Ma_DH inner join Product_tb p on d1.ProductID=p.ID  where d0.Ma_DH='{0}'", dh);
                DataTable dt = xl.ExcuteSQL_Table(sql);

                grvDonhang.DataSource = dt;
                grvDonhang.DataBind();

                GridViewDataColumn col1 = grvDonhang.Columns["Thanhtien"] as GridViewDataColumn;
                ASPxLabel lbtota1 = (ASPxLabel)grvDonhang.FindFooterCellTemplateControl(col1, "lbTong");
                lbtota1.Text = Utils.GetMoneyString(double.Parse(dt.Rows[0]["thanhtien"].ToString())) + "đ";

                lb.InnerText = dt.Rows[0]["Ma_DH"].ToString();
            }
            catch (Exception) { }
            
        }

       
        protected void grvDonhang_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                 String dh = Request.QueryString["k"];
                 Bindata_noLog(dh);
            }
            
        }

       
    }
}